<template>
    <el-form label-width="80px">
        <el-form-item label="原密码">
            <el-input v-model="form.oldPwd" type="password" />
        </el-form-item>
        <el-form-item label="新密码">
            <el-input v-model="form.password" type="password" />
        </el-form-item>
        <el-form-item label="确认密码">
            <el-input v-model="form.twicePwd" type="password" />
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="modify">立即修改</el-button>
        </el-form-item>
    </el-form>
</template>

<script setup>
    import {
        ref
    } from "vue"
    import {
        modifyPwd
    } from '@/api'
    import {
        ElMessage
    } from "element-plus"
    import {
        useRouter
    } from 'vue-router'
    const $router = useRouter()
    let form = ref({})
    let modify = async _ => {
        let r = await modifyPwd(form.value)
        ElMessage.success(r.msg)
        setTimeout(_ => {
            localStorage.clear()
            $router.push('/login')
        }, 1000)
    }
</script>

<style>

</style>